 package 文件与io流;
//io流升级版
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.Reader;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.Writer;
import java.nio.channels.NonWritableChannelException;
import java.io.FileWriter;
import java.io.IOException;
public class F1 {
	public static void main(String [] args) throws Exception
	{
//		//1.字节缓冲流
//		InputStream is=new FileInputStream("D:\\代码\\firstDemo\\src\\firstDemo\\example");
//		BufferedInputStream bs=new BufferedInputStream(is);
////		int line;
////		while((line=bs.read())!=-1)
////		{
////			System.out.println((char) line);
////		}		
		
//		byte[] arr=new byte[3];
//		int len;
//		while((len=bs.read(arr))!=-1)
//		{
//			System.out.print(new String(arr,0,len));
//		}
		
		
//		//2.字符缓冲流
//		Reader is=new FileReader("D:\\代码\\firstDemo\\src\\firstDemo\\example");
//		BufferedReader br=new BufferedReader(is);
////		String line;
////		while((line=br.readLine())!=null)
////		{
////			System.out.println(line);
////		}
		
//		Writer fw=new FileWriter("D:\\代码\\firstDemo\\src\\firstDemo\\example1");
//		BufferedWriter bw=new BufferedWriter(fw);
//		String line;
//		while((line=br.readLine())!=null)
//		{
//			bw.write(line);
//			bw.newLine();
//		}
//		bw.close();
//		br.close();
		
		
		//3.转换流
//		InputStream is=new FileInputStream("D:\\代码\\firstDemo\\src\\firstDemo\\example");
//		Reader rs=new InputStreamReader(is);
//		BufferedReader br=new BufferedReader(rs);
//		String line;
//		while((line=br.readLine())!=null)
//		{
//			System.out.println(line);
//		}
//		br.close();
//		rs.close();
//		
//		InputStream is1=new FileInputStream("D:\\代码\\firstDemo\\src\\firstDemo\\example");
//		Reader rs1=new InputStreamReader(is1);
//		OutputStream os=new FileOutputStream("D:\\代码\\firstDemo\\src\\firstDemo\\example1");
//		Writer ws=new OutputStreamWriter(os);
//		char[] arr=new char[10];
//		int len;
//		while((len=rs1.read(arr))!=-1)
//		{
//			ws.write(arr,0,len);
//			System.out.print(new String(arr,0,len));
//		}
//		is1.close();
//		ws.close();
		
		
		//4.打印流
//		PrintStream ps=new PrintStream(new FileOutputStream("D:\\代码\\firstDemo\\src\\firstDemo\\example1",true),true);
//		ps.println(false);
//		ps.println(99);
//		ps.println("床前明月光");
//		ps.write(97);
		
//		PrintWriter pw=new PrintWriter(new FileWriter("D:\\代码\\firstDemo\\src\\firstDemo\\example1",true),true);
//		pw.println("床前明月光");
//		pw.close();
		
		}
}
